#pragma once

template <class TT>
class WinScopeLock_T
{
public:
	explicit WinScopeLock_T(TT& mutex) : m_mutex(mutex)
	{
		m_mutex.lock();
	}
	WinScopeLock_T(TT& mutex, long millisec) : m_mutex(mutex)
	{
		m_mutex.lock(millisec);
	}
	~WinScopeLock_T()
	{
		m_mutex.unlock();
	}

private:
	TT& m_mutex;

	WinScopeLock_T();
	WinScopeLock_T(const WinScopeLock_T&);
	WinScopeLock_T& operator = (const WinScopeLock_T&);
};
